//
//  LeftTableViewCell.swift
//  hangge_2258
//
//  Created by hangge on 2019/1/8.
//  Copyright © 2019年 hangge. All rights reserved.
//

import UIKit

import SnapKit



//左侧表格的自定义单元格
class SSLeftTableViewCell: UITableViewCell {
    
    var redPoint = UIView()
    //标题文本标签
    var titleLabel = UILabel()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        //选中样式无
        selectionStyle = .none
        
        //初始化标题文本标签
        titleLabel.frame = CGRect(x: 15, y: 0, width: self.frame.width, height: 55)
        titleLabel.numberOfLines = 0
        titleLabel.font = UIFont.systemFont(ofSize: 16, weight: .medium)
        titleLabel.textColor = UIColor(hex: "000000")?.withAlphaComponent(0.6)
        titleLabel.highlightedTextColor = UIColor.themeColor
        contentView.addSubview(titleLabel)
        
        let redPoint = UIView()
        self.addSubview(redPoint)
        redPoint.snp.makeConstraints { make in
            make.centerY.equalTo(self.frame.height/2.0 + 4)
            make.right.equalTo(-12)
            make.height.width.equalTo(6)
        }
        redPoint.backgroundColor = UIColor.red
        redPoint.layer.cornerRadius = 3
        self.redPoint = redPoint
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    func setSelectedStyle(selected:Bool) {
        contentView.backgroundColor = selected ? UIColor(254, 254, 254)
            : UIColor(246, 246, 246)
        titleLabel.isHighlighted = selected
    }
    
    //设置选中样式
//    override func setSelected(_ selected: Bool, animated: Bool) {
//        super.setSelected(selected, animated: animated)
//        contentView.backgroundColor = selected ? UIColor(254, 254, 254)
//            : UIColor(246, 246, 246)
////        isHighlighted = selected
//        titleLabel.isHighlighted = selected
//
//    }
}

